home *** CD-ROM | disk | FTP | other *** search
- " ------------------------------------------------------------------- "
- " MenuFlags Class is a Singleton class that allows the user "
- " to reference Menu & MenuItem flags without knowing their "
- " hexadecimal values. "
- ""
- " The User does NOT need to create one of these, since Intuition "
- " Class will instantiate the only needed instance of this Class. See "
- " the SetupIntuition.st source file for the method(s) that help the "
- " User with this Class. "
- ""
- " ALL singleton classes MUST contain the following: "
- ""
- " the methods: isSingleton AND privateSetup AND "
- " uniqueInstance Class instance variable. "
- " ------------------------------------------------------------------- "
-
- Class MenuFlags :Dictionary ! uniqueInstance !
- [
- isSingleton
- ^ true
- |
- privateNew ! newinstance !
- newinstance <- super new.
-
- ^ newinstance
- |
- new
- ^ self privateSetup
- |
- privateSetup
- (uniqueInstance isNil)
- ifTrue: [uniqueInstance <- self privateNew.
-
- self at: #MENUENABLED put: 1. " whether or not this menu is enabled "
-
- " FLAGS SET BY INTUITION (For Menus): "
-
- self at: #MIDRAWN put: 16r100. " this menu's items are currently drawn "
-
- self at: #CHECKIT put: 1. " set to indicate checkmarkable item "
- self at: #ITEMTEXT put: 2. " set if textual, clear if graphical item "
- self at: #COMMSEQ put: 4. " set if there's an command sequence "
- self at: #MENUTOGGLE put: 8. " set for toggling checks (else mut. exclude) "
- self at: #ITEMENABLED put: 16. " set if this item is enabled "
-
- " these are the SPECIAL HIGHLIGHT FLAG state meanings: "
-
- self at: #HIGHFLAGS put: 16rC0. " see definitions below for these bits "
- self at: #HIGHIMAGE put: 0. " use the user's 'select image' "
- self at: #HIGHCOMP put: 16r40. " highlight by complementing the selectbox "
- self at: #HIGHBOX put: 16r80. " highlight by 'boxing' the selectbox "
- self at: #HIGHNONE put: 16rC0. " don't highlight "
-
- " FLAGS SET BY BOTH APPLIPROG AND INTUITION: "
-
- self at: #CHECKED put: 16r100. " state of the checkmark "
-
- " FLAGS SET BY INTUITION (For MenuItems & SubItems): "
-
- self at: #ISDRAWN put: 16r1000. " this item's subs are currently drawn "
- self at: #HIGHITEM put: 16r2000. " this item is currently highlighted "
- self at: #MENUTOGGLED put: 16r4000. " this item was already toggled "
-
- " NewMenus tags & flags: "
-
- self at: #NM_TITLE put: 1. "For NewMenus"
- self at: #NM_ITEM put: 2. "For NewMenus"
- self at: #NM_SUB put: 3. "For NewMenus"
- self at: #NM_END put: 0. "For NewMenus"
- self at: #NM_IGNORE put: 64. "For NewMenus"
- self at: #NM_BARLABEL put: -1. "For NewMenus"
-
- self at: #IM_ITEM put: 130. " Graphical menu item "
- self at: #IM_SUB put: 131. " Graphical menu sub-item "
- self at: #NM_MENUDISABLED put: 1. " Same as MENU_ENABLED "
- self at: #NM_ITEMDISABLED put: 16. " Same as ITEMENABLED "
-
- self at: #NM_COMMANDSTRING put: 4. " Same as COMMSEQ "
- self at: #NM_FLAGMASK put: 16r39. "(~(COMMSEQ | ITEMTEXT | HIGHFLAGS))"
- self at: #NM_FLAGMASK_V39 put: 16r3D. "(~(ITEMTEXT | HIGHFLAGS))"
-
- " These return codes can be obtained through the GTMN_SecondaryError tag "
-
- " Too many menus, items, or subitems, menu has been trimmed down: "
- self at: #GTMENU_TRIMMED put: 1.
- self at: #GTMENU_INVALID put: 2. " Invalid NewMenu array "
- self at: #GTMENU_NOMEM put: 3. " Out of memory "
-
- self at: #GTMN_TextAttr put: 16r80080031. " MenuItem font TextAttr "
- self at: #GTMN_FrontPen put: 16r80080032. " MenuItem text pen color "
-
- " Pointer to Menu for use by LayoutMenuItems(): "
- self at: #GTMN_Menu put: 16r8008003C.
-
- " Asks CreateMenus() to validate that this is a complete menu structure: "
- self at: #GTMN_FullMenu put: 16r8008003E.
-
- " ti_Data is a pointer to ULONG to receive error reports from CreateMenus()"
- self at: #GTMN_SecondaryError put: 16r8008003F.
-
- " ti_Data is checkmark img to use: "
- self at: #GTMN_Checkmark put: 16r80080041.
-
- " ti_Data is Amiga-key img to use: "
- self at: #GTMN_AmigaKey put: 16r80080042.
-
- self at: #GTMN_NewLookMenus put: 16r80080043. " ti_Data is boolean "
- ].
-
- ^ self "or ^ uniqueInstance??"
- ]
-